'************************************************************************************************************************ 'Description: ' ' This example finds the add-ins associated with a specific Business component. ' If some of the necessary add-ins are not yet loaded, it loads them, restarts OpenText Functional Testing, opens the Business component, ' and confirms that the opened document is in fact a business component. ' '************************************************************************************************************************ Dim qtApp 'As QuickTest.Application ' Declare the Application object variable Dim arrBCAddins ' Declare the variable for storing the component's associated add-ins Dim blnNeedChangeAddins ' Declare a flag for indicating whether the component's associated add-ins are currently loaded Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object qtApp.Launch ' Start the application qtApp.Visible = True ' Make the application visible qtApp.TDConnection.Connect "http://qcserver/qcbin", _ "MY_DOMAIN", "My_Project", "James", "not4you", False ' Connect to ALM If qtApp.TDConnection.IsConnected Then ' If connection is successful arrBCAddins = qtApp.GetAssociatedAddinsForBC("[QualityCenter] Components\MyFolder\MyBC") ' Check if all required add-ins are all already loaded blnNeedChangeAddins = False ' Assume no change is necessary For Each bcAddin In arrBCAddins ' Iterate over the component's associated add-ins list If qtApp.Addins(bcAddin).Status <> "Active" Then ' If an associated add-in is not loaded blnNeedChangeAddins = True ' Indicate that a change in the loaded add-ins is necessary Exit For ' Exit the loop End If Next If qtApp.Launched And blnNeedChangeAddins Then qtApp.Quit ' If a change is necessary, exit the application to modify the loaded add-ins End If If blnNeedChangeAddins Then Dim blnActivateOK blnActivateOK = qtApp.SetActiveAddins(arrBCAddins, errorDescription) ' Load the add-ins associated with the component and check whether they load successfully. If Not blnActivateOK Then ' If a problem occurs while loading the add-ins MsgBox errorDescription ' Show a message containing the error WScript.Quit ' And end the automation application. End If End If End If If Not qtApp.Launched Then ' If the application is not yet open qtApp.Launch ' Start the application (with the correct add-ins loaded) qtApp.Visible = True ' Make the application visible qtApp.TDConnection.Connect "http://qcserver/qcbin", _ "MY_DOMAIN", "My_Project", "James", "not4you", False ' Connect to ALM End If If qtApp.TDConnection.IsConnected Then ' If connection is successful qtApp.OpenBusinessComponent "[QualityCenter] Components\MyFolder\MyBC", False ' Open the business component MsgBox qtApp.CurrentDocumentType 'Confirm that the open document is a business component End If